<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/pages/template/page-begin.jspf" %>
<%
	_pageTitle = "Update Profile"; 
	_pageId = "register"; 
	_mainPageId = "register"; 
%>
<%@ include file="/pages/template/head-begin.jspf" %>
<%@ include file="/pages/template/head-end.jspf" %>

<body>
	<%@ include file="/pages/template/content-begin.jspf" %>
	<%@ include file="/pages/template/bar-left.jspf" %>
	<%@ include file="/pages/template/bar-right.jspf" %>
	
	<div id="content" >
	<jsp:useBean id="registerUserForm" class="com.mobilottery.ui.RegisterForm" scope="session"/>
	<% registerUserForm.reset(); %>
	<jsp:setProperty name="registerUserForm" property="*" />
	<% boolean isPostRequest = "POST".equals(request.getMethod()); %>
	<%
		if(isPostRequest)//submitted form?
		{
			registerUserForm.submit();
		}
	%>	
	
	<% if(!isPostRequest || !registerUserForm.isSubmitted()){ %>
	 	
	<form class="detailForm" action="register.jsp" method="post">
	<table border="0" class="formTable" align="center">
	<tr>
		<th colspan="3">Register New User</th>
	</tr>
	<tr>
		<td>User:</td>
		<td class="fieldc">
			<input type="text" value="<%=registerUserForm.getUserName()%>" name="userName" />
			<div class="fieldErrorMessage"><%=registerUserForm.getFieldErorrMesssage("userName")%></div>
		</td>
		
	</tr>
	<tr>
		<td>Password:</td> <td class="fieldc">
			<input type="password" value="<%=registerUserForm.getPassword()%>" name="password" />
			<div class="fieldErrorMessage"><%=registerUserForm.getFieldErorrMesssage("password")%></div>
		</td>
	</tr>
	<tr>
		<td>First Name:</td> 
		<td class="fieldc">
			<input type="text" value="<%=registerUserForm.getFirstName()%>" name="firstName" />
			<div class="fieldErrorMessage"><%=registerUserForm.getFieldErorrMesssage("firstName")%></div>
		</td>
	</tr>
	<tr>
		<td>Last Name:</td> 
		<td class="fieldc">
			<input type="text" value="<%=registerUserForm.getLastName()%>" name="lastName" />
			<div class="fieldErrorMessage"><%=registerUserForm.getFieldErorrMesssage("lastName")%></div>
		</td>
	</tr>
	<tr>
		<td>E-mail:</td> 
		<td class="fieldc">
			<input type="text" value="<%=registerUserForm.getEmail()%>" name="email" />
			<div class="fieldErrorMessage"><%=registerUserForm.getFieldErorrMesssage("email")%></div>
		</td>
	</tr>
	<tr>
		<td>Credit Card:</td> 
		<td class="fieldc">
			<input type="text" value="<%=registerUserForm.getCreditCardNumber()%>" name="creditCardNumber" />
			<div class="fieldErrorMessage"><%=registerUserForm.getFieldErorrMesssage("creditCardNumber")%></div>
		</td>
	</tr>
	<tr>
		<td colspan="3" align="right">
		<hr />
		</td>
	</tr>	
	<tr>
		<td align="left">
			<a href="register.jsp">Clear</a>
		</td>
		<td colspan="2" align="right">
			<input type="submit" class="formBtn" value="Register" style="width: 100px;" />
		</td>
	</tr>	
	<tr>
		<td class="fieldErrorMessage" colspan="3" align="center" style="font-size: 14px;"><%=registerUserForm.getFieldErorrMesssage("form")%></td>
	</tr>
	</table>
	</form>
	
	<%}else{ %>
	<table border="0" class="formTable" align="center" style="width:300px;"">
	<tr>
		<th>Registration Succesfull!</th>
	</tr>
	<tr>
		<td>
		<p>
		User <i><%=registerUserForm.getUserName()%></i> has been registered succesfully and logged in! 
		</p>
		<p>
		Use this user name for mobile login or future site logins.
		</p> 
		</td>		
	</tr>
	</table>	
	<%} %>

	
	</div>

	<jsp:include page="/pages/template/content-end.jspf" />
	
</body>
</html>
